
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yysk_app/utils/colors.dart';
import 'package:yysk_app/utils/helper.dart';
import 'package:yysk_app/widget/button_widget.dart';
import 'package:yysk_app/widget/image_asset_widget.dart';
import 'open_wallet_fail_controller.dart';
import 'package:yysk_app/widget/custom_app_bar2.dart';

class OpenWalletFailPage extends GetView<OpenWalletFailController> {
  static const path = '/openWalletFail';
  const OpenWalletFailPage({super.key});

  @override
  Widget build(BuildContext context) {
    final double top = MediaQuery.of(context).padding.top;
    final reason = Get.arguments?['reason'] ?? '未知原因';
    final channel =  (Get.arguments['channel'] ?? '') == 'DEBIT_CARD' ? 'HUIFU' : 'DIN_PAY';
    return  
    
    Scaffold(
      body: Stack(
          children: [
            //添加背景色，代码如下：
            SizedBox(
              width: context.width,
              child: ImageAssetWidget(
                width: double.infinity,
                height: 173.px,
                imageUrl: 'static/images/wallet/top_bg.png',
              ),
            ),
            Padding(
              padding: EdgeInsets.fromLTRB(0, top, 0, 24.px),
              child: Column(
                  children: [
                    CustomAppBar2(title: channel == 'HUIFU'?'汇付支付':'智付支付', context: context),
                    Expanded(
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          const SizedBox(height: 60),
                          // 失败icon
                          ImageAssetWidget(
                            imageUrl: 'static/images/wallet/open_wallet_fail.png',
                            width: 148,
                            height: 130,
                          ),
                          const SizedBox(height: 32),
                          const Text('开通失败', style: TextStyle(color: AppColors.fontColorGreen ,fontSize: 30, fontWeight: FontWeight.bold, fontFamily: 'CustomFont')),
                          const SizedBox(height: 12),
                          Text('失败原因：$reason', style: const TextStyle(fontSize: 14)),
                          const SizedBox(height: 32),
                          ButtonWidget(
                            label: '重新开通',
                            height: 32.px,
                            width: 106.px,
                            fontSize: 12.px,
                            fontColor: AppColors.fontColorGreen,
                            imageBg: 'static/images/wallet/wallet_cancel_btn.png',
                            contentType: ContentType.text,
                            onPressed: controller.retry,
                          ),
                          Spacer()
                          // OutlinedButton(
                          //   onPressed: controller.retry,
                          //   style: OutlinedButton.styleFrom(
                          //     side: const BorderSide(color: Colors.black),
                          //     shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
                          //     padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 12),
                          //   ),
                          //   child: const Text('重新开通', style: TextStyle(fontSize: 18, color: Colors.black)),
                          // ),
                        ],
                      ),
                    ),
                  ],
                ),
            ),
          ],
        ),
    );
  }
}